<template>
    <div>
        <div class="head">
            <div class="head-on">
                <span class="shouye">首页</span>
                <div class="tubiao"><van-icon name="chat-o" color="#FFFFFF" size="20px" @click="newFU" /></div>
            </div>
            <div class="head-down">
                <div class="shopping" ><img :src="data.img" /></div>
                <div class="message">
                    <div class="shopping-name" >{{ data.name }}</div>
                    <div class="shopping-message">
                        <div class="shopping-m" @click="xinxi()">{{ data.content }}</div>
                        <div class="shopping-state" @click="tap()">
                            {{ data.BusinessStatus }}<van-icon name="arrow" color="#FFFFFF" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    name: 'HomeHead',
    data() {
        return {
            data: {
                id: 1,
                img: 'https://cdn3.axureshop.com/demo/1525603/images/%E9%80%89%E6%8B%A9%E5%BA%97%E9%93%BA/u1063.png',
                name: '默林如斯的广东肠粉早餐店(凤凰广场店)',
                content: '查看店铺信息',
                BusinessStatus: ''  
            }
        }
    },
    created(){
        this.data.BusinessStatus=this.$store.state.BusinessStatus  //从vuex里获取营业状态
    },
    methods: {
        tap() {
            // let state = this.data.state
            if (this.data.BusinessStatus == '营业中') {
                this.$router.push('/InBusiness')
            } else if (this.data.BusinessStatus == '待营业') {
                this.$router.push('/ToOpened')
            } else if (this.data.BusinessStatus == '休息中') {
                this.$router.push('/CloseView')
            }
        },
        xinxi() {
            this.$router.push('/tar')
        },
        newFU() {
            this.$router.push('/HomeMess')
        }
    }
}
</script>
<style scoped>
* {
    margin: 0;
    padding: 0;
}
* {
    font-size: 15px;
}
.head {
    width: 100%;
    /* height: 20vw; */
    background-color: #ff6e53;
}
.head-on {
    display: flex;
    position: relative;
}
.shouye {
    margin: 15px auto;
    font-size: 18px;
    color: #ffffff;
}
.tubiao {
    right: 1px;
    margin: 20px;
    position: absolute;
}
.head-down {
    width: 100%;
    display: flex;
    align-items: center;
    height: 90px;
}
.shopping {
    width: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.message {
    width: 70%;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-around;
}
.shopping-name {
    color: #ffffff;
    font-size: 16px;
    width: 176px;
}
.shopping-message {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.shopping-m {
    color: #cccccc;
    font-size: 13px;
}
.shopping-state {
    color: #ffffff;
    font-size: 15px;
    width: 80px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    background-color: #ff9986;
    border-radius: 15px 0px 0px 15px;
}
</style>
